package Background;

import java.io.Serializable;

/**
 * This class is used as a super class to combine the common aspects between
 * each type of user.
 * 
 * @author Justin Sorrell
 * @version 1/30/2013
 * 
 */

public abstract class User implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * Field used to store the name of the person.
	 */
	
	private String MY_NAME;
	
	/**
	 * Field used to store the email of each person.
	 */
	
	private String MY_EMAIL;
	
	/**
	 * Field used to store a confirmation string comparing the emails.
	 */
	
	private String MY_CONFIRM;
	
	/**
	 * Field used to store a designated user name for each person.
	 */
	
	private String MY_USERNAME;
	
	/**
	 * Field used to store a designated password for each person.
	 */
	
	private String MY_PASSWORD;
	
	/**
	 * Field used to store the phone number of each person.
	 */
	
	private String MY_NUMBER;
	
	/**
	 * A boolean to determine if a user is currently signed in.
	 */
	
	private boolean isActive = false;
	
	/**
	 * A boolean to decide if the user is a contestant or not.
	 */
	
	public boolean isContestant;
	
	public User()
	{
		
	}
	
	/**
	 * Constructor for the basic user. The types of users will be contestants,
	 * judges and an organizer.
	 * 
	 * @param name The first and last name of the user.
	 * @param email The email provided by the user upon registration.
	 * @param confirm A variable used to confirm the email address.
	 * @param userName The user name chosen by the user upon registration.
	 * @param password The password chosen by the user upon registration.
	 * @param number The phone number provided by user upon registration.
	 */

	public User(String name, String email, String confirm, String userName,
			String password, String number, boolean contestantStatus) {
		MY_NAME = name;
		MY_EMAIL = email;
		MY_CONFIRM = confirm;
		MY_USERNAME = userName;
		MY_PASSWORD = password;
		MY_NUMBER = number;
		isContestant = contestantStatus;

	}

	/**
	 * Setter for the user's name.  This is used if the user provided an incorrect name during the
	 * registration process.
	 * @param name The name of the user.
	 */
	public void setName(String name) {

		MY_NAME = name;
	}

	/**
	 * Getter for the user's name. This retrieves the user's name.
	 * @return MY_NAME The user's name.
	 */
	public String getName() {

		return MY_NAME;
	}

	/**
	 * Setter for the user's email.  This is used if the user provides an incorrect email
	 * address during the registration process.  The user would have to have provided the
	 * incorrect email address twice for this to occur.
	 * @param email The email address to set.
	 */
	public void setEmail(String email) {
		MY_EMAIL = email;

	}

	/**
	 * Getter for the user's email. This retrieves the user's email.   
	 * @return MY_EMAIL The user's email address.
	 */
	
	public String getEmail() {

		return MY_EMAIL;
	}

	/**
	 * Setter for the confirmation email address.  Used during the registration process only. 
	 * @param confirm The second email address entered should match the first. 
	 */
	
	public void setConfirm(String confirm) {
		MY_CONFIRM = confirm;

	}

	/**
	 * Getter for the confirmation email address.  Used during the registration process only
	 * to confirm if the person registering has entered the same email address twice.
	 * @return MY_CONFIRM The confirmed email address.
	 */
	
	public String getConfirm() {

		return MY_CONFIRM;
	}

	/**
	 * Setter for the username chosen by the user.   
	 * @param userName The username chosen by the user.
	 */
	
	public void setUserName(String userName) {
		MY_USERNAME = userName;

	}

	/**
	 * Getter for the username.
	 * @return MY_USERNAME The username chosen by the user during registration.
	 */
	
	public String getUserName() {

		return MY_USERNAME;
	}

	/**
	 * Setter for the user's password.  Sets the user's password to the one chosen during
	 * registration. 
	 * @param password The password to set.
	 */
	
	public void setPassword(String password) {
		MY_PASSWORD = password;

	}

	/**
	 * Getter for the user's password.  Retrieves a forgotten password. 
	 * @return MY_PASSWORD The password chosen by the user.
	 */
	
	public String getPassword(){
		return MY_PASSWORD;
	}
	
	/**
	 * Setter for the phone number.  The user sets this during registration.
	 * @param number The number to set.
	 */
	
	public void setPhoneNumber(String number) {
		MY_NUMBER = number;

	}

	/**
	 * Getter for the user's phone number.  For use in by organizer when a user needs to be
	 * contacted. 
	 * @return MY_NUMBER The number entered by the user during registration.
	 */
	
	public String getPhoneNumber() {

		return MY_NUMBER;
	}

	/**
	 * Checks to see if the current user is signed in.
	 * @return the isActive True if the user is signed in, false otherwise.
	 */

	public boolean isActive() {
		return isActive;
	}

	/**
	 * Sets the user to be currently signed in.
	 * @param isActive the isActive to set
	 */

	public void setActive() {
		isActive = true;
	}
	
	/**
	 * Adds the contestant to the list. 
	 * @param the_contestant The contestant to add.
	 */
	
	public void addContestant(Contestant the_contestant){
		Lists.addContestant(the_contestant);
	}
	
	/**
	 * Adds the judge to the list.
	 * @param the_judge The judge to add to the list.
	 */
	
	public void addJudge(Judge the_judge){
		Lists.addJudge(the_judge);
	}

}
